# Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.html

# import scrapy
#
# class QidianHotItem(scrapy.Item):
#     # define the fields for your item here like:
#     # name = scrapy.Field()
#     name = scrapy.Field()
#     author = scrapy.Field()

import scrapy
from itemloaders.processors import TakeFirst

# 定义一个转换小说形式的函数
def form_convert(form):
    if form[0] == '连载':
        return 'LZ'
    else:
        return 'WJ'

class QidianHotItem(scrapy.Item):
    #TakeFirst为scrapy中的一个内置处理器，获取列表中的第一个非空数据
    name = scrapy.Field(output_processor=TakeFirst())
    author = scrapy.Field(output_processor=TakeFirst())
    form = scrapy.Field(input_processor=form_convert, output_processor=TakeFirst())

class LianjiaHomeItem(scrapy.Item):
    name = scrapy.Field()
    type = scrapy.Field()
    area = scrapy.Field()
    direction = scrapy.Field()
    fitment = scrapy.Field()
    elevator = scrapy.Field()
    total_price = scrapy.Field()
    unit_price = scrapy.Field()
    property = scrapy.Field()

class Qqmusic(scrapy.Item):
    song_name = scrapy.Field()
    album_name = scrapy.Field()
    singer_name = scrapy.Field()
    interval = scrapy.Field()

class DoubanMoive(scrapy.Item):
    title = scrapy.Field()
    directors = scrapy.Field()
    casts = scrapy.Field()
    rate = scrapy.Field()

class ToutiaoItem(scrapy.Item):
    title = scrapy.Field()
    source = scrapy.Field()
    comment = scrapy.Field()

class JingdongItem(scrapy.Item):
    price = scrapy.Field()
    title = scrapy.Field()
    store = scrapy.Field()

class SeabornFileItem(scrapy.Item):
    file_urls = scrapy.Field()
    files = scrapy.Field()

class ShetuImageItem(scrapy.Item):
    title = scrapy.Field()
    image_urls = scrapy.Field()
    images = scrapy.Field()